#ifndef __DALELIB_TEXTURE_H__
#define __DALELIB_TEXTURE_H__

//#pragma link("ILU.lib")

#include <dalelib/graphics.h>
#include <IL/il.h>
#include <IL/ilu.h>
#include <vector>

using namespace std;

namespace dalelib
{

class Texture
{
private:

	GLuint _handle;
	bool _first;
	static bool very_first;
	int _width;
	int _height;
	int _bytes_per_pixel;
	GLenum _image_format;
	unsigned char* _pixel_data;

public:

	Texture() : _first(true), _pixel_data(0) { }
	~Texture()
	{
		if( !_first ) glDeleteTextures( 1, &_handle );
		if( _pixel_data ) delete [] _pixel_data;
	}
	GLuint getHandle() const { return _handle; }
	int getWidth() { return _width; }
	int getHeight() { return _height; }
	int getBpp() { return _bytes_per_pixel; }
	int load(const string _Name, const bool _Keep=false);
	void bind();
	void unbind();

};

} // namespace dalelib

#endif
